<?php

class ANotify extends Notify
{
	function PrintTextValue($text)
	{
		print(str_replace(array("\"","'"),array("&quot;","&#039;"), $text));
	}
	function halt($message="",$iff=1,$meta='') 
	{
		$url					= "";
		$meta					= "";
	
		if ($iff == 1)
		{
			$url				= "<form method=\"POST\" action=\"{$_SERVER["HTTP_REFERER"]}\" name=\"frmback\"></form>[ <a href=\"javascript:document.frmback.submit()\">back</a> ]";
		}
		elseif($iff == 2)
		{
			$form					= "";
			while(list($key,$value) = each($_POST))
			{
				if(is_array($value))
				{
					for($i=0;$i<count($value);$i++)
					{
						$value[$i]	= stripslashes($value[$i]);
						$form		= "$form<input type=\"hidden\" name=\"$key\[\]\" value=\"{$value[$i]}\">";	
					}
				}
				else
				{
					$value			= stripslashes($value);
					$form			= "$form<input type=\"hidden\" name=\"$key\" value=\"$value\">";
				}
			}
			$url				= "<form method=\"POST\" action=\"{$_SERVER["REQUEST_URI"]}\" name=\"frmback\">$form<input type=\"hidden\" name=\"WARMYSAVEERRTRY\" value=\"1\"></form>[ <a href=\"javascript:document.frmback.submit()\">try</a> ]";
		}
		elseif($iff == "ERR")
		{
			$form					= "";
			while(list($key,$value) = each($_POST))
			{
				if(is_array($value))
				{
					for($i=0;$i<count($value);$i++)
					{
						$value[$i]	= stripslashes($value[$i]);
						$form		= "$form<input type=\"hidden\" name=\"$key\[\]\" value=\"{$value[$i]}\">";	
					}
				}
				else
				{
					$value			= stripslashes($value);
					$form			= "$form<input type=\"hidden\" name=\"$key\" value=\"$value\">";
				}
			}
			$url				= "<form method=\"POST\" action=\"{$_SERVER["HTTP_REFERER"]}\" name=\"frmback\">$form<input type=\"hidden\" name=\"WARMYSAVEERR\" value=\"1\"></form>[ <a href=\"javascript:document.frmback.submit()\">try</a> ]";
		}
		elseif($iff == "SUCCESS")
		{
			$url = get_cookie("SYSTEM_HTTP_REFERER");
			$meta				= "<meta http-equiv=\"refresh\" content=\"3;URL=$url\"/>";
			$url				= "<a href=\"$url\">back</a>";
		}
		elseif($iff == "")
		{
			if(isset($_SERVER["HTTP_REFERER"]) && $_SERVER["HTTP_REFERER"] != "")
				$url			= $_SERVER["HTTP_REFERER"];
			else
				$url			= $_SERVER["REQUEST_URI"];
			$meta				= "<meta http-equiv=\"refresh\" content=\"3;URL=$url\"/>";
			$url				= "<a href=\"$url\">back</a>";
		}
		elseif($iff == "back")
		{
			$url				= "[ <a href=\"Javascript:window.history.go(-1);\">back</a> ]";
		}
		else
		{
			$url				= "<a href=\"$iff\">back</a>";
			$meta				= "<meta http-equiv=\"refresh\" content=\"3;URL=$iff\"/>";
		}
		ob_end_clean();
		$charset = CHARSET;
		$out_print =  <<< EOT
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
		<html xmlns="http://www.w3.org/1999/xhtml"> 
		<head> 
		<meta http-equiv="Content-Type" content="text/html; charset=$charset"/> 
		$meta 
		<title>Message</title> 
		<link href="/css/notify.css" rel="stylesheet" type="text/css" /> 
		</head> 
		<body> 
		<div class="message"> 
		<div id="caption">提示信息</div> 
		<div id="body">$message</div> 
		<div id="back"> $url </div> 
		</div> 
		</body> 
		</html>
EOT;
		print($out_print);
		exit;

	}
	function ClearHTML($str)
	{
		$pattern = "<.[^>]*>";
		$str	= eregi_replace($pattern,"",$str);
		return $str;
	}
}
?>